<%@ page import="net.tribal.comic.entities.Note" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <title><g:message code="title.note.edit"/></title>
    </head>
    <body>
    
        <div class="navButtonsTop rounded-corners">
			<h1 class="title"><g:message code="title.note.edit"/></h1>
        </div>
        
   		<g:form method="post" >
   			<div class="element rounded-corners">
	        
	        	<g:hasErrors bean="${noteInstance}">
					<div class="errors rounded-corners"><g:renderErrors bean="${noteInstance}" as="list" /></div>
	      		</g:hasErrors>

				<div class="tableCreate">
		            <table>
		                <tbody>
		                    <tr>
		                        <td class="name ${hasErrors(bean: noteInstance, field: 'title', 'errors')}">
		                        	<label for="title"><g:message code="default.label.title"/>:</label>
		                       	</td>
		                       	<td class="value requiredField ${hasErrors(bean: noteInstance, field: 'title', 'errors')}">
		                            <g:textField class="focus" name="title" size="80" maxlength="100" value="${fieldValue(bean: noteInstance, field: 'title')}" />
		                        </td>
		                        <td class="name ${hasErrors(bean: noteInstance, field: 'disabled', 'errors')}">
		                        	<label for="disabled"><g:message code="default.label.disabled"/>:</label>
		                        </td>
		                       	<td class="value ${hasErrors(bean: noteInstance, field: 'disabled', 'errors')}">	
		                            <g:checkBox name="disabled" value="${noteInstance?.disabled}" />
		                        </td>
		                    </tr>
		                
		                    <tr>
		                        <td colspan="4" class="${hasErrors(bean: noteInstance, field: 'text', 'errors')}">
									<richui:richTextEditor name="text" value="${noteInstance?.text}" width="600" />
		                        </td>
		                    </tr>
		                </tbody>
		            </table>
	            </div>
	           </div> 
	            
				<div class="navButtons rounded-corners">
					<usr:isAdmin>
						<div class="left">
							<g:actionSubmit class="update" action="update" value="${message(code:'default.button.update')}"/>
						</div>
						<div class="right">
							<g:actionSubmit class="back" action="list" value="${message(code:'default.button.back')}"/>
						</div>
					</usr:isAdmin>
				</div>
			
			<g:hiddenField name="id" value="${noteInstance?.id}" />
            <g:hiddenField name="version" value="${noteInstance?.version}" />
		</g:form>
    </body>
</html>
